<#assign base=request.contextPath />
<#assign oneLabel="ERP管理">

<#assign twoLabel="员工管理">
<#assign twoUrl=base+"/contract/list">

<#assign leafLabel="员工考勤">
<!DOCTYPE html>
<html lang="en">
<head>
	<link rel="stylesheet" href="${base}/static/assets/css/chosen.css" />
	<#include "/commons/headImport.ftl">
</head>
<body>
<#include "/commons/header.ftl">
<form class="form-horizontal" name="formName" method="post">
<div class="row">
	<div class="col-sm-12">
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">名称 </label>
			<div class="col-sm-3">
				<select class="form-control user-chosen-select" name="qyemployeeId" id="user-select" >
                    <option value="">--请选择--</option>
                </select>
            	<input type="hidden" id="user_list_id" value="${queryVO.qyemployeeId!}">
			</div>
			<label class="col-sm-2 control-label no-padding-right">考勤日期</label>
			<div class="col-sm-3">
				<div class="row">
                    <div class="col-xs-12">
                        <div class="input-group input-group-sm">
                            <input type="text" class="form-control date-picker" name="qyworkDate" AUTOCOMPLETE="off"
                            	value="${(queryVO.qyworkDate?string("yyyy-MM-dd"))!}" data-date-format="yyyy-mm-dd"/>
                            <span class="input-group-addon"><i class="icon-calendar"></i></span>
                        </div>
                    </div>
            	</div>
			</div>
		</div>
		<div class="space-4"></div>
		
		<div class="form-group">
			<div class="col-sm-4orm-group center">
				<label class="col-sm-2 control-label no-padding-right"></label>
				<div class="col-sm-3"></div>
				<button class="btn btn-xs btn-success" type="button" id="search_id" url="${base}/attendance/list">
					<i class="icon-search icon-on-right bigger-110"></i>查询
				</button>
				<button class="btn btn-xs" type="reset" id="reset_id" url="${base}/attendance/list">
					<i class="icon-undo bigger-110"></i>重置
				</button>
			</div>
		</div>
		<div class="space-4"></div>
		
		<div class="widget-box transparent">
			<div class="widget-header widget-header-flat">
				<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
					<a class="btn btn-minier btn-success" id="artificial_id" url="${base}/attendance/add">
						<i class="icon-plus bigger-110"></i>新增考勤
					</a>
				</div>					
			</div>

			<div class="widget-body">
				<div class="widget-main no-padding">
					<table class="table table-striped table-bordered">
						<thead class="thin-border-bottom">
							<tr>
								<th class="center" width="5%">#</th>
								<th width="10%">姓名</th>
								<th width="10%">出勤日期</th>
								<th width="20%">时间</th>
								<th width="10%">状态</th>
								<th width="20%">备注</th>
								<th width="25%"></th>
							</tr>
						</thead>
	
						<tbody>
							<#if pr??>
							<#list pr.data as data>
							<tr>
								<td class="center">${data_index+1}</td>
								<td>${(data.employeeDO.fullName)!'-'}</td>
								<td>${(data.workDate?string("yyyy-MM-dd"))!''}</td>
								<td>${data.startWorkTime!''}-${data.endWorkTime!''}</td>
								<td>${statusMap['${data.status}']!'--'}</td>
								<td>${data.remark!''}</td>
								<td>
									<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
										<a class="btn btn-minier btn-success" href="javascript:openPaymentEdit('${base}/attendance/edit/${data.id}');" title="编辑">
											<i class="icon-edit bigger-120"></i>编辑
										</a>
										<a class="btn btn-minier btn-danger" href="javascript:delPaymentRow('${base}/payment/delete/${data.id}');" title="删除">
											<i class="icon-trash bigger-120"></i>删除
										</a>
									</div>
								</td>
							</tr>
							</#list>
							</#if>
							<#if !pr.data?? ||((pr.data)?size==0)>
								<tr>
									<td colspan="18" class="center">没有查询任何数据</td>
								</tr>
							</#if>
						</tbody>
					</table>
				</div><!-- /.widget-main -->
			</div><!-- /.widget-body -->
		</div><!-- /.widget-box -->
			
		<div class="space-4"></div>
		<@p.p pageParam=pr toURL="${base}/attendance/list" formName="formName"/>
		
	</div><!-- /.col -->
</div><!-- /.row -->
</form>

<#include "/commons/footer.ftl">
</body>
<script src="${base}/static/assets/js/date-time/bootstrap-datepicker.min.js"></script>
<script src="${base}/static/assets/js/date-time/bootstrap-datepicker.zh-CN.js"></script>
<script src="${base}/static/layer/layer.js"></script>
<script src="${base}/static/assets/js/chosen.jquery.min.js"></script>
<script src="${base}/static/js/erp/employee.js"></script>
<script type="text/javascript">
	
	jQuery(function($) {
		
	   $("#artificial_id").click(function(){
	   		var url=$(this).attr("url");
			layer.open({
		      type: 2,
		      title: '新增考勤',
		      maxmin: true,
		      shadeClose: true, //点击遮罩关闭层
		      area : ['900px' , '600px'],
		      content: url
		    });
	   });
	      
	   $('.date-picker').datepicker({
	   		language: 'zh-CN',//选择语言
			autoclose: true,
			todayHighlight: true,
			clearBtn:true
		});
	});
	
	function openPaymentEdit(url) {
		layer.open({
	      type: 2,
	      title: '编辑考勤',
	      maxmin: true,
	      shadeClose: true, //点击遮罩关闭层
	      area : ['800px' , '450px'],
	      content: url
		});
	}
	
	function delPaymentRow(url){
		layer.confirm('确定要删除？', {
		  btn: ['删除','取消']
		}, function(){
			layer.load(2);
			$.get(url,function(data){
			     if(data.success){
			     	layer.closeAll('loading');
			     	window.location.reload();
			     }else{
			     	var json = JSON.stringify(data.msg);
			     	layer.msg(json);
			     	layer.closeAll('loading');
			     }
			 });
		}, function(){
		});
	}
</script>
</html>
